package edu.umb.cs.antmanager.common;

import static edu.umb.cs.antmanager.common.Constants.*;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

public class RMIServerConnector {

	public static AgentInterface createAgentConnector(String machineName)
			throws MalformedURLException, RemoteException, NotBoundException {
		return (AgentInterface) Naming.lookup("//" + machineName + ":"
				+ SERVER_PORT + "/" + AGENT_SERVER_NAME);
	}

	public static ManagerInterface createManagerConnector(String machineName)
			throws MalformedURLException, RemoteException, NotBoundException {
		return (ManagerInterface) Naming.lookup("//" + machineName + ":"
				+ SERVER_PORT + "/" + MANAGER_SERVER_NAME);
	}

}
